ABC133 B - Good Distance
提出
WA
code: python
import itertools
import math
n, d = map(int, input().split())
ans = 0
for dis in itertools.combinations(x, 2):
res = 0
for i in range(d):
res += math.pow(abs(int(dis0i)) - abs(int(dis1i)), 2) if (math.sqrt(res).is_integer()):
ans += 1
print(ans)
解答
code: python
import math
n, d = map(int,input().split())
ans = 0
for i in range(n):
for j in range(i+1, n):
dis = 0
for k in range(d):
dis = math.sqrt(dis)
if dis == int(dis):
ans += 1
print(ans)
提出
code: python
import math
n, d = map(int, input().split())
ans = 0
for i in range(n-1):
for j in range(i+1, n):
res = 0
for k in range(d):
res += math.pow(abs(xik-xjk), 2) if (math.sqrt(res).is_integer()):
ans += 1
print(ans)